﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="admin_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
        <asp:ImageButton ID="ImageButton1" runat="server" onclick="ImageButton1_Click" 
            Width="78px" />
        <br />
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
            DataKeyNames="ProductId">
            <Columns>
                <asp:BoundField DataField="ProductId" HeaderText="ProductId" ReadOnly="True" 
                    SortExpression="ProductId" />
                <asp:BoundField DataField="ProductName" HeaderText="ProductName" 
                    SortExpression="ProductName" />
                <asp:BoundField DataField="CategoryId" HeaderText="CategoryId" 
                    SortExpression="CategoryId" />
                <asp:BoundField DataField="Size" HeaderText="Size" SortExpression="Size" />
                <asp:BoundField DataField="Color" HeaderText="Color" SortExpression="Color" />
                <asp:BoundField DataField="Price" HeaderText="Price" SortExpression="Price" />
                <asp:BoundField DataField="Url_img" HeaderText="Url_img" 
                    SortExpression="Url_img" />
            </Columns>
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:ASPDB %>" 
            SelectCommand="SELECT * FROM [Products]" 
            DeleteCommand="DELETE FROM [Products] WHERE [ProductId] = @ProductId" 
            InsertCommand="INSERT INTO [Products] ([ProductId], [ProductName], [CategoryId], [Size], [Color], [Price], [Url_img]) VALUES (@ProductId, @ProductName, @CategoryId, @Size, @Color, @Price, @Url_img)" 
            UpdateCommand="UPDATE [Products] SET [ProductName] = @ProductName, [CategoryId] = @CategoryId, [Size] = @Size, [Color] = @Color, [Price] = @Price, [Url_img] = @Url_img WHERE [ProductId] = @ProductId">
            <DeleteParameters>
                <asp:Parameter Name="ProductId" Type="String" />
            </DeleteParameters>
            <InsertParameters>
                <asp:Parameter Name="ProductId" Type="String" />
                <asp:Parameter Name="ProductName" Type="String" />
                <asp:Parameter Name="CategoryId" Type="String" />
                <asp:Parameter Name="Size" Type="Int32" />
                <asp:Parameter Name="Color" Type="String" />
                <asp:Parameter Name="Price" Type="Double" />
                <asp:Parameter Name="Url_img" Type="String" />
            </InsertParameters>
            <UpdateParameters>
                <asp:Parameter Name="ProductName" Type="String" />
                <asp:Parameter Name="CategoryId" Type="String" />
                <asp:Parameter Name="Size" Type="Int32" />
                <asp:Parameter Name="Color" Type="String" />
                <asp:Parameter Name="Price" Type="Double" />
                <asp:Parameter Name="Url_img" Type="String" />
                <asp:Parameter Name="ProductId" Type="String" />
            </UpdateParameters>
        </asp:SqlDataSource>
        <br />
        <br />
          <asp:ListView runat="server" ID="listView1" GroupItemCount="3" 
            style="margin-right: 19px">
        <LayoutTemplate>
            <div style="width: 100%;">
                <asp:PlaceHolder runat="server" ID="groupPlaceHolder" />
            </div>
        </LayoutTemplate>
        <GroupTemplate>
            <div style="clear: both;">
                <asp:PlaceHolder runat="server" ID="itemPlaceHolder" />
            </div>
        </GroupTemplate>
        <ItemTemplate>
            <div class="productItem">
                <div>
                    <img src='<%# Eval("Url_img") %>'
                        height="200" width="200" alt="hoi lam gi" >
                        </img>
                </div>
                <div>
                    <b>
                        <asp:LinkButton ID="LinkButton1" runat="server"><%# Eval("ProductName") %></asp:LinkButton>   </b></div>
                <div>
                    Price: $<%# Eval("Price") %></div>
            </div>
        </ItemTemplate>
        <ItemSeparatorTemplate>
            <div class="itemSeparator">
            </div>
        </ItemSeparatorTemplate>
        <GroupSeparatorTemplate>
            <div class="groupSeparator">
            </div>
        </GroupSeparatorTemplate>
        <EmptyDataTemplate>
        </EmptyDataTemplate>
    </asp:ListView>
        <br />
        <br />
    </div>
    </form>
</body>
</html>
